package com.my.study.designPatterns.iteratorPattern;

import java.util.ArrayList;
import java.util.List;

public class PancakeHouseMenuIteraotor implements Iterator<MenuItem>{

    int pos = 0;

    List<MenuItem> menuItems = new ArrayList<>();

    public PancakeHouseMenuIteraotor(List<MenuItem> menuItems) {
        this.menuItems = menuItems;
    }

    @Override
    public Boolean hasNext() {

        if(pos < menuItems.size()){
            return true;
        }
        return false;
    }

    @Override
    public MenuItem next() {

        MenuItem menuItem = menuItems.get(pos);
        pos ++;
        return menuItem;
    }
}
